/* DATA STRUCTURES IN C Practice Project
     1. Linear List
        -> (1) Sequential List  (2) Linked List    
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  - Authored by Mr. Xu Tao on 2025/4/13              *
*  - Contacts : Gitee @zefeng97 ; Mail xutal@qq.com   *
*  - Algorithm:                                       *
*       InitList  GetElem  LocateElem  InsertList     *
*       DeleteList                                    *
* * * * * * * * * * * * * * * * * * * * * * * * * * * */

#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OVERFLOW -2
#define ERROR -1
#define MAX 100  //定义线性表最大数据量

//构造类型
typedef struct {  //声明一个名称为book的结构体，内容包含no、name、price三个变量
	char no[20];
	char name[50];
	float price;
}Book;

//构造顺序表
typedef struct {  //声明一个booklist的结构体，内容包含elem指向book的指针、length两个变量
	Book* elem;
	int length;
}Booklist;

//声明初始化顺序表算法
void InitList(Booklist* booklist, int NUM);
//声明构造顺序表取值算法
int GetEelm(const Booklist get, int i, Book* e);
//声明查找顺序表算法
int LocateElem(const Booklist * locate, const Book* book);
//声明插入顺序表算法
int InsertList(Booklist* insert, const Book book, int i);
//声明删除顺序表算法
void DeleteList(Booklist* denum, int i);